package com.jill.jianghu.action.test;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateCalculate {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Calendar start = Calendar.getInstance();
		start.set(2005, 4, 7);

		Calendar now = Calendar.getInstance();
		now.setTime(new Date());
		
		long sub = now.getTimeInMillis() - start.getTimeInMillis();
		long day = 24 * 60 * 60 * 1000;
		float week = day * 7;
		float month = day * 30;
		float year = day * 365;
		System.out.println("李晓娜已经陪刘涛大人：");
		System.out.println(sub/day + " Days");
		System.out.println(sub/week + " Weeks");
		System.out.println(sub/month + " Months");
		System.out.println(sub/year + " Years");
		Calendar cal = Calendar.getInstance();
		cal.setTimeInMillis(sub);
		SimpleDateFormat sdf = new SimpleDateFormat("y-MM-dd hh:mm:ss");
		System.out.println(sdf.format(cal.getTime()).substring(1));
	}

}
